home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 November
/
Macworld (1999-11).dmg
/
Shareware World
/
Utilities
/
Text Processing
/
Jedit3.0
/
Jedit3
/
Jedit3.rsrc
/
TEXT_1000_RegularExpression Help.txt
< prev
next >
Wrap
Text File
|
1999-09-01
|
3KB
|
94 lines
^ beginning of line
if ^ is the first character in the pattern
Sample: ^subj: line start with 'subj:'
$ end of line
if $ is the last character in the pattern.
The result doesn't contain return code.
To contain return code, specify '\r' instead.
Sample: ^$ blank line (without return code)
Sample: ^\r blank line (with return code)
. any character
Sample: a.d
Start with 'a' and follwed by any character and
end with 'd'. It matches in 'and', 'add', 'dandy'.
* zero or more specified patterns
Sample: an*d
Start with 'a' and follewed by zero or more 'n's
and end with 'd'. It matches in 'and', 'advance',
'add'.
+ one or more specified patterns
Sample: an+d
Start with 'a' and follewed by one or more 'n's
and end with 'd'. It matches 'and', 'annd' but
not in 'advance', 'add'.
? zero or one specified pattern
Sample: an?d
Start with 'a' and follewed by zero or one 'n'
and end with 'd'. It matches 'and', 'add' but
not 'annd'.
\ escape
Use escape pairs when you want to express
characters that has special meanig in regular
expression such as '^', '$', '\'.
Sample: \^ character '^' as data
Sample: \\ character '\' as data
Sample: \$ character '$' as data
Sample: \* character '*' as data
Sample: \+ character '+' as data
Use escape pairs to express none-printing
characters as follows.
'\t' =TAB, '\r' =CR, '\n' =LF,
'\s' =SPACE, '\b' =BS
To express characters as hex-decimal codes,
use '\h' follewed by its hex-decimal codes.
Sample: \h20 space (one byte)
Sample: \h8140 two bytes kanji space
[ ] character class
Set and range pattens matches some characters.
You can use also 2byte characters as its components.
Use '-' to express the range pattern.
Use '^' to express the exception set.
Sample: [abc] any one of characters a, b, c.
Sample: [A-Z] any one of characters in the range
A to Z, capital alphabets.
Sample: [^a-z] any one of characters except small
alphabets.
Sample: [a-xABC]
any one of characters in the range a
to x or characters A, B, C.
Sample: [\t\s\h8140]+$
one more continuous characters of
tab, space or kanji space at the end
of line.
{} group
Use {} to divide find strings into desired groups that
are used in replacement strings.
For example, person name is expressed as follows.
{[A-Z][a-z]+}\s+{[A-Z][a-z]+}
First group {[A-Z][a-z]+} is given name.
Second group {[A-Z][a-z]+} is family name.
First group is expressed as \1 in replacement string,
second group is \2.
To replace names to family name first styles, specify
follwoing replacement string.
\2, \1
Family name is first, follewed by comma and given
name.